﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Threading;

namespace ScanSnap.Wpf.WpfWindow
{
    /// <summary>
    /// Interaction logic for SplashWindow.xaml
    /// </summary>
    public partial class SplashWindow : Window
    {
        private DispatcherTimer timer;

        public SplashWindow()
        {

            InitializeComponent();

            //LoginWindow.Instance.Show();
            //this.Close();

            this.timer = new DispatcherTimer();
            this.timer.Tick += timer_Tick;
            this.timer.Interval = new System.TimeSpan(0, 0, 1);
            this.timer.Start();
        }

        private void timer_Tick(object sender, System.EventArgs e)
        {
            if (System.DateTime.Now.Second % pb.Maximum == 0)
            {
                timer.IsEnabled = false;
                MainWindow.Instance.Show();
                this.Close();
            }
            else
                this.pb.Value = System.DateTime.Now.Second % pb.Maximum;
        }
    }
}
